package com.geektime.hello;

import java.io.*;

/**
 * @Date 2020-10-24 17:07
 * @Author Pzy
 * @Description
 */
public class CopyFileDemo {
    public static void main(String[] args) {
        try (InputStream in = new FileInputStream("D:\\nio_write.txt");
            OutputStream out = new FileOutputStream("D:\\nio_copy.txt");
        ) {
            int n;
            byte[] b = new byte[1024];
            while ((n = in.read(b)) != -1) {
                out.write(b, 0, n);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
